\doxysubsection{dgr\+\_\+demo.\+cc}
\hypertarget{dgr__demo_8cc_source}{}\label{dgr__demo_8cc_source}\index{examples/dgr\_demo.cc@{examples/dgr\_demo.cc}}
\mbox{\hyperlink{dgr__demo_8cc}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00001}00001\ \textcolor{comment}{/*\ -\/*-\/\ Mode:C++;\ c-\/file-\/style:"{}gnu"{};\ indent-\/tabs-\/mode:nil;\ -\/*-\/\ */}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00002}00002\ \textcolor{preprocessor}{\#include\ <ctime>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00003}00003\ \textcolor{preprocessor}{\#include\ <sstream>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00004}00004\ \textcolor{preprocessor}{\#include\ "{}ns3/core-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00005}00005\ \textcolor{preprocessor}{\#include\ "{}ns3/network-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00006}00006\ \textcolor{preprocessor}{\#include\ "{}ns3/internet-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00007}00007\ \textcolor{preprocessor}{\#include\ "{}ns3/point-\/to-\/point-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00008}00008\ \textcolor{preprocessor}{\#include\ "{}ns3/applications-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00009}00009\ \textcolor{preprocessor}{\#include\ "{}ns3/netanim-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00010}00010\ \textcolor{preprocessor}{\#include\ "{}ns3/topology-\/read-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00011}00011\ \textcolor{preprocessor}{\#include\ "{}ns3/traffic-\/control-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00012}00012\ \textcolor{preprocessor}{\#include\ "{}ns3/node-\/list.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00013}00013\ \textcolor{preprocessor}{\#include\ "{}ns3/dgrv2-\/module.h"{}}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00014}00014\ \textcolor{preprocessor}{\#include\ <stdlib.h>}\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00015}00015\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00016}00016\ \textcolor{preprocessor}{\#include\ <list>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00017}00017\ \textcolor{preprocessor}{\#include\ <fstream>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00018}00018\ \textcolor{preprocessor}{\#include\ <sstream>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00019}00019\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00020}00020\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00021}00021\ \textcolor{keyword}{using\ namespace\ }\mbox{\hyperlink{namespacens3}{ns3}};}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00022}00022\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00023}\mbox{\hyperlink{dgr__demo_8cc_adf12170ede4e9e3a5cc1339bfd5809e0}{00023}}\ std::string\ \mbox{\hyperlink{dgr__demo_8cc_adf12170ede4e9e3a5cc1339bfd5809e0}{expName}}\ =\ \textcolor{stringliteral}{"{}dgrv2\_demo"{}};}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00024}00024\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00025}\mbox{\hyperlink{dgr__demo_8cc_a74e095ce7015b761478d9cddb8f25c44}{00025}}\ \mbox{\hyperlink{dgr__demo_8cc_a74e095ce7015b761478d9cddb8f25c44}{NS\_LOG\_COMPONENT\_DEFINE}}\ (\mbox{\hyperlink{dgr__demo_8cc_adf12170ede4e9e3a5cc1339bfd5809e0}{expName}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00026}00026\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00027}00027\ \textcolor{keywordtype}{int}\ main\ (\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ *argv[])}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00028}00028\ \{}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00029}00029\ \ \ Packet::EnablePrinting\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00030}00030\ \ \ std::string\ topo\ (\textcolor{stringliteral}{"{}2\_node"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00031}00031\ \ \ std::string\ format\ (\textcolor{stringliteral}{"{}Inet"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00032}00032\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00033}00033\ \ \ \textcolor{comment}{//\ Set\ up\ command\ line\ parameters\ used\ to\ control\ the\ experiment.}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00034}00034\ \ \ CommandLine\ cmd\ (\_\_FILE\_\_);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00035}00035\ \ \ cmd.AddValue\ (\textcolor{stringliteral}{"{}format"{}},\ \textcolor{stringliteral}{"{}Format\ to\ use\ for\ data\ input\ [Orbis|Inet|Rocketfuel]."{}},}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00036}00036\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ format);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00037}00037\ \ \ cmd.AddValue\ (\textcolor{stringliteral}{"{}topo"{}},\ \textcolor{stringliteral}{"{}topology"{}},\ topo);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00038}00038\ \ \ cmd.Parse\ (argc,\ argv);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00039}00039\ \ \ std::string\ input\ (\textcolor{stringliteral}{"{}contrib/dgrv2/topo/Inet\_"{}}\ +\ topo\ +\ \textcolor{stringliteral}{"{}\_topo.txt"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00040}00040\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00041}00041\ \ \ \textcolor{comment}{//\ -\/-\/\ Read\ topology\ data.}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00042}00042\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00043}00043\ \ \ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00044}00044\ \ \ \textcolor{comment}{//\ Pick\ a\ topology\ reader\ based\ in\ the\ requested\ format.}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00045}00045\ \ \ TopologyReaderHelper\ topoHelp;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00046}00046\ \ \ topoHelp.SetFileName\ (input);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00047}00047\ \ \ topoHelp.SetFileType\ (format);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00048}00048\ \ \ Ptr<TopologyReader>\ inFile\ =\ topoHelp.GetTopologyReader\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00049}00049\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00050}00050\ \ \ NodeContainer\ nodes;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00051}00051\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00052}00052\ \ \ \textcolor{keywordflow}{if}\ (inFile)}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00053}00053\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00054}00054\ \ \ \ \ \ \ nodes\ =\ inFile-\/>Read\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00055}00055\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00056}00056\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00057}00057\ \ \ \textcolor{keywordflow}{if}\ (inFile-\/>LinksSize\ ()\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00058}00058\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00059}00059\ \ \ \ \ \ \ NS\_LOG\_ERROR\ (\textcolor{stringliteral}{"{}Problems\ reading\ the\ topology\ file.\ Failing."{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00060}00060\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00061}00061\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00062}00062\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00063}00063\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00064}00064\ \ \ \textcolor{comment}{//\ -\/-\/\ Create\ nodes\ and\ network\ stacks}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00065}00065\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00066}00066\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}creating\ internet\ stack"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00067}00067\ \ \ InternetStackHelper\ stack;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00068}00068\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00069}00069\ \ \ \textcolor{comment}{//\ Setup\ Routing\ algorithm}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00070}00070\ \ \ \mbox{\hyperlink{classns3_1_1_ipv4_d_g_r_routing_helper}{Ipv4DGRRoutingHelper}}\ dgr;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00071}00071\ \ \ Ipv4ListRoutingHelper\ list;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00072}00072\ \ \ list.Add\ (dgr,\ 10);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00073}00073\ \ \ InternetStackHelper\ internet;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00074}00074\ \ \ internet.SetRoutingHelper\ (list);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00075}00075\ \ \ internet.\mbox{\hyperlink{classns3_1_1_ipv4_d_g_r_routing_helper_ad05361fcc3a278d151e9c98fa815552d}{Install}}\ (nodes);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00076}00076\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00077}00077\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}creating\ ipv4\ addresses"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00078}00078\ \ \ Ipv4AddressHelper\ address;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00079}00079\ \ \ address.SetBase\ (\textcolor{stringliteral}{"{}10.0.0.0"{}},\ \textcolor{stringliteral}{"{}255.255.255.252"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00080}00080\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00081}00081\ \ \ \textcolor{keywordtype}{int}\ totlinks\ =\ inFile-\/>LinksSize\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00082}00082\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00083}00083\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}creating\ node\ containers"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00084}00084\ \ \ NodeContainer*\ nc\ =\ \textcolor{keyword}{new}\ NodeContainer[totlinks];}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00085}00085\ \ \ NetDeviceContainer*\ ndc\ =\ \textcolor{keyword}{new}\ NetDeviceContainer[totlinks];}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00086}00086\ \ \ PointToPointHelper\ p2p;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00087}00087\ \ \ TrafficControlHelper\ tch;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00088}00088\ \ \ tch.SetRootQueueDisc\ (\textcolor{stringliteral}{"{}ns3::DGRv2QueueDisc"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00089}00089\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}creating\ ipv4\ interfaces"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00090}00090\ \ \ Ipv4InterfaceContainer*\ ipic\ =\ \textcolor{keyword}{new}\ Ipv4InterfaceContainer[totlinks];}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00091}00091\ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}totlinks\ number:\ "{}}\ <<\ totlinks\ <<\ std::endl;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00092}00092\ \ \ TopologyReader::ConstLinksIterator\ iter;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00093}00093\ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}\ =\ 0;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00094}00094\ \ \ \textcolor{keywordflow}{for}\ (\ iter\ =\ inFile-\/>LinksBegin\ ();\ iter\ !=\ inFile-\/>LinksEnd\ ();\ iter++,\ \mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}++)}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00095}00095\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00096}00096\ \ \ \ \ \ \ nc[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]\ =\ NodeContainer\ (iter-\/>GetFromNode\ (),\ iter-\/>GetToNode\ ());}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00097}00097\ \ \ \ \ \ \ std::string\ delay\ =\ iter-\/>GetAttribute\ (\textcolor{stringliteral}{"{}Weight"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00098}00098\ \ \ \ \ \ \ std::stringstream\ ss;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00099}00099\ \ \ \ \ \ \ ss\ <<\ delay;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00100}00100\ \ \ \ \ \ \ uint16\_t\ metric;\ \ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00101}00101\ \ \ \ \ \ \ ss\ >>\ metric;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00102}00102\ \ \ \ \ \ \ p2p.SetChannelAttribute\ (\textcolor{stringliteral}{"{}Delay"{}},\ StringValue\ (delay\ +\ \textcolor{stringliteral}{"{}ms"{}}));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00103}00103\ \ \ \ \ \ \ p2p.SetDeviceAttribute\ (\textcolor{stringliteral}{"{}DataRate"{}},\ StringValue\ (\textcolor{stringliteral}{"{}100Mbps"{}}));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00104}00104\ \ \ \ \ \ \ ndc[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]\ =\ p2p.Install\ (nc[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00105}00105\ \ \ \ \ \ \ \textcolor{comment}{//\ QueueDiscContainer\ container\ =\ }}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00106}00106\ \ \ \ \ \ \ tch.Install\ (ndc[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00107}00107\ \ \ \ \ \ \ \textcolor{comment}{//\ std::cout\ <<\ "{}the\ container\ size:\ "{}\ <<\ container.GetN\ ()\ <<\ std::endl;}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00108}00108\ \ \ \ \ \ \ \textcolor{comment}{//\ container.Get\ (0)-\/>GetInternalQueue\ (0)-\/>SetMaxSize\ (QueueSize\ ("{}250KB"{}));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00109}00109\ \ \ \ \ \ \ \textcolor{comment}{//\ container.Get\ (1)-\/>GetInternalQueue\ (0)-\/>SetMaxSize\ (QueueSize\ ("{}250KB"{}));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00110}00110\ \ \ \ \ \ \ ipic[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]\ =\ address.Assign\ (ndc[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}]);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00111}00111\ \ \ \ \ \ \ ipic[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}].SetMetric\ (0,\ metric);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00112}00112\ \ \ \ \ \ \ ipic[\mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}].SetMetric\ (1,\ metric);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00113}00113\ \ \ \ \ \ \ address.NewNetwork\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00114}00114\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00115}00115\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00116}00116\ \ \ \mbox{\hyperlink{classns3_1_1_ipv4_d_g_r_routing_helper_a67901bf47957ab420b596cdb38a38882}{Ipv4DGRRoutingHelper::PopulateRoutingTables}}\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00117}00117\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00118}00118\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00119}00119\ \ \ \textcolor{comment}{//\ -\/-\/\ Print\ routing\ table}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00120}00120\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00121}00121\ \ \ \mbox{\hyperlink{classns3_1_1_ipv4_d_g_r_routing_helper}{Ipv4DGRRoutingHelper}}\ d;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00122}00122\ \ \ Ptr<OutputStreamWrapper>\ routingStream\ =\ Create<OutputStreamWrapper>}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00123}00123\ \ \ (topo\ +\ \textcolor{stringliteral}{"{}\_"{}}\ +\ \mbox{\hyperlink{dgr__demo_8cc_adf12170ede4e9e3a5cc1339bfd5809e0}{expName}}\ +\ \textcolor{stringliteral}{"{}.routes"{}},\ std::ios::out);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00124}00124\ \ \ d.PrintRoutingTableAllAt\ (Seconds\ (0),\ routingStream);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00125}00125\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00126}00126\ \ \ \textcolor{comment}{//\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ Udp\ traffic\ 0-\/-\/>2\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00127}00127\ \ \ \textcolor{comment}{//\ uint16\_t\ udpPort\ =\ 9;}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00128}00128\ \ \ \textcolor{comment}{//\ uint32\_t\ udpSink\ =\ 3;}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00129}00129\ \ \ \textcolor{comment}{//\ uint32\_t\ udpSender\ =\ 0;}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00130}00130\ \ \ \textcolor{comment}{//\ Ptr<Node>\ udpSinkNode\ =\ nodes.Get\ (udpSink);}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00131}00131\ \ \ \textcolor{comment}{//\ Ptr<Ipv4>\ ipv4UdpSink\ =\ udpSinkNode-\/>GetObject<Ipv4>\ ();}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00132}00132\ \ \ \textcolor{comment}{//\ Ipv4InterfaceAddress\ iaddrUdpSink\ =\ ipv4UdpSink-\/>GetAddress\ (1,0);}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00133}00133\ \ \ \textcolor{comment}{//\ Ipv4Address\ ipv4AddrUdpSink\ =\ iaddrUdpSink.GetLocal\ ();}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00134}00134\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00135}00135\ \ \ \textcolor{comment}{//\ DGRSinkHelper\ sinkHelper\ ("{}ns3::UdpSocketFactory"{},}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00136}00136\ \ \ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InetSocketAddress\ (Ipv4Address::GetAny\ (),\ udpPort));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00137}00137\ \ \ \textcolor{comment}{//\ ApplicationContainer\ sinkApp\ =\ sinkHelper.Install\ (nodes.Get\ (udpSink));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00138}00138\ \ \ \textcolor{comment}{//\ sinkApp.Start\ (Seconds\ (0.0));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00139}00139\ \ \ \textcolor{comment}{//\ sinkApp.Stop\ (Seconds\ (20.0));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00140}00140\ \ \ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00141}00141\ \ \ \textcolor{comment}{//\ //\ udp\ sender}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00142}00142\ \ \ \textcolor{comment}{//\ Ptr<Socket>\ udpSocket\ =\ Socket::CreateSocket\ (nodes.Get\ (udpSender),\ UdpSocketFactory::GetTypeId\ ());}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00143}00143\ \ \ \textcolor{comment}{//\ Ptr<DGRUdpApplication>\ app\ =\ CreateObject<DGRUdpApplication>\ ();}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00144}00144\ \ \ \textcolor{comment}{//\ app-\/>Setup\ (udpSocket,\ InetSocketAddress\ (ipv4AddrUdpSink,\ udpPort),\ 150,\ 10,\ DataRate\ ("{}1Mbps"{}),\ 1000,\ false);}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00145}00145\ \ \ \textcolor{comment}{//\ nodes.Get\ (udpSender)-\/>AddApplication\ (app);}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00146}00146\ \ \ \textcolor{comment}{//\ app-\/>SetStartTime\ (Seconds\ (1.0));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00147}00147\ \ \ \textcolor{comment}{//\ app-\/>SetStopTime\ (Seconds\ (20.0));}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00148}00148\ \ \ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00149}00149\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ TCP\ Back\ ground\ traffic\ 0-\/-\/>2\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00150}00150\ \ \ uint16\_t\ tcpPort\ =\ 8080;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00151}00151\ \ \ uint32\_t\ tcpSink\ =\ 3;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00152}00152\ \ \ uint32\_t\ tcpSender\ =\ 0;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00153}00153\ \ \ Ptr<Node>\ tcpSinkNode\ =\ nodes.Get\ (tcpSink);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00154}00154\ \ \ Ptr<Ipv4>\ ipv4TcpSink\ =\ tcpSinkNode-\/>GetObject<Ipv4>\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00155}00155\ \ \ Ipv4InterfaceAddress\ iaddrTcpSink\ =\ ipv4TcpSink-\/>GetAddress\ (1,0);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00156}00156\ \ \ Ipv4Address\ ipv4AddrTcpSink\ =\ iaddrTcpSink.GetLocal\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00157}00157\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00158}00158\ \ \ \mbox{\hyperlink{classns3_1_1_d_g_r_sink_helper}{DGRSinkHelper}}\ sinkHelper\ (\textcolor{stringliteral}{"{}ns3::TcpSocketFactory"{}},}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00159}00159\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InetSocketAddress\ (Ipv4Address::GetAny\ (),\ tcpPort));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00160}00160\ \ \ ApplicationContainer\ sinkApp\ =\ sinkHelper.Install\ (nodes.Get\ (tcpSink));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00161}00161\ \ \ sinkApp.Start\ (Seconds\ (0.0));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00162}00162\ \ \ sinkApp.Stop\ (Seconds\ (20.0));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00163}00163\ \ \ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00164}00164\ \ \ \textcolor{comment}{//\ tcp\ send}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00165}00165\ \ \ \mbox{\hyperlink{classns3_1_1_d_g_r_tcp_app_helper}{DGRTcpAppHelper}}\ sourceHelper\ (\textcolor{stringliteral}{"{}ns3::TcpSocketFactory"{}},}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00166}00166\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InetSocketAddress\ (ipv4AddrTcpSink,\ tcpPort));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00167}00167\ \ \ sourceHelper.SetAttribute\ (\textcolor{stringliteral}{"{}MaxBytes"{}},\ UintegerValue\ (7500000));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00168}00168\ \ \ sourceHelper.SetAttribute\ (\textcolor{stringliteral}{"{}Budget"{}},\ UintegerValue\ (100));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00169}00169\ \ \ ApplicationContainer\ sourceApp\ =\ sourceHelper.Install\ (nodes.Get\ (tcpSender));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00170}00170\ \ \ sourceApp.Start\ (Seconds\ (1.0));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00171}00171\ \ \ sourceApp.Stop\ (Seconds\ (20.0));}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00172}00172\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00173}00173\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00174}00174\ \ \ \textcolor{comment}{//\ -\/-\/\ Net\ anim}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00175}00175\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00176}00176\ \ \ AnimationInterface\ anim\ (topo\ +\ \mbox{\hyperlink{dgr__demo_8cc_adf12170ede4e9e3a5cc1339bfd5809e0}{expName}}\ +\ \textcolor{stringliteral}{"{}.xml"{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00177}00177\ \ \ std::ifstream\ topoNetanim\ (input);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00178}00178\ \ \ std::istringstream\ buffer;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00179}00179\ \ \ std::string\ line;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00180}00180\ \ \ getline\ (topoNetanim,\ line);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00181}00181\ \ \ \textcolor{keywordflow}{for}\ (uint32\_t\ \mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}\ =\ 0;\ \mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}\ <\ nodes.GetN\ ();\ \mbox{\hyperlink{namespacens3_aa5e169e2453984d2f21c0d5cec9e907b}{i}}\ ++)}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00182}00182\ \ \ \{}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00183}00183\ \ \ \ \ getline\ (topoNetanim,\ line);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00184}00184\ \ \ \ \ buffer.clear\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00185}00185\ \ \ \ \ buffer.str\ (line);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00186}00186\ \ \ \ \ \textcolor{keywordtype}{int}\ no;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00187}00187\ \ \ \ \ \textcolor{keywordtype}{double}\ x,\ y;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00188}00188\ \ \ \ \ buffer\ >>\ no;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00189}00189\ \ \ \ \ buffer\ >>\ x;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00190}00190\ \ \ \ \ buffer\ >>\ y;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00191}00191\ \ \ \ \ anim.SetConstantPosition\ (nodes.Get\ (no),\ x*10,\ y*10);}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00192}00192\ \ \ \}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00193}00193\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00194}00194\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00195}00195\ \ \ \textcolor{comment}{//\ -\/-\/\ Run\ the\ simulation}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00196}00196\ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00197}00197\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}Run\ Simulation."{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00198}00198\ \ \ Simulator::Run\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00199}00199\ \ \ Simulator::Destroy\ ();}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00200}00200\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00201}00201\ \ \ \textcolor{keyword}{delete}[]\ ipic;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00202}00202\ \ \ \textcolor{keyword}{delete}[]\ ndc;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00203}00203\ \ \ \textcolor{keyword}{delete}[]\ nc;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00204}00204\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00205}00205\ \ \ NS\_LOG\_INFO\ (\textcolor{stringliteral}{"{}Done."{}});}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00206}00206\ }
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00207}00207\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{dgr__demo_8cc_source_l00208}00208\ \}}

\end{DoxyCode}
